/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bankingsystem;

import java.io.Serializable;

/**
 *
 * @author Pushpalanka
 */

/**
 * As the same customer can act as a borrower and a depositor and as keeping both information with
 * the customer is easier in operations,  no separate classes were created.
 */
public class Customer implements Serializable{

    private String name;
    private String customerID;
    private String address;
    private int teleNo;
    private String NICno;
    private String password;
    private String fixedAccountNo;
    private String currentAccountNo;
    private String savingsAccountNo;
    private String loanNo;
    /*
     * To avoid java.io.invalidclassexception local class incompatible error as customer object is going to have added feilds at
     * runtime. Any missmatch at serialization and deserializing is avoided here.
     */
    static final long serialVersionUID = 6650909721368869386L;
 

    Customer() {
    }

    /**
     * Assumed that to be a customer of the bank, having an active saving,fixed or current account or a
     * loan is not essential
     */
    
    public Customer(String name, String customerID, String address, int teleNo, String NICno, String password) {
        this.name = name;
        this.customerID = customerID;
        this.address = address;
        this.teleNo = teleNo;
        this.NICno = NICno;
        this.password = password;
    }

    //no get method to password, becuase of security reasons
    public String getNICno() {
        return NICno;
    }

    public String getAddress() {
        return address;
    }

    public String getCustomerID() {
        return customerID;
    }

    public String getName() {
        return name;
    }

    public int getTeleNo() {
        return teleNo;
    }

    public String getCurrentAccountNo() {
        return currentAccountNo;
    }

    public String getFixedAccountNo() {
        return fixedAccountNo;
    }

    public String getLoanNo() {
        return loanNo;
    }

    public String getSavingsAccountNo() {
        return savingsAccountNo;
    }

    
    public void setNICno(String NICno) {
        this.NICno = NICno;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setCustomerID(String customerID) {
        this.customerID = customerID;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setTeleNo(int teleNo) {
        this.teleNo = teleNo;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setCurrentAccountNo(String currentAcoountNo) {
        this.currentAccountNo = currentAcoountNo;
    }

    public void setFixedAccountNo(String fixedAcoountNo) {
        this.fixedAccountNo = fixedAcoountNo;
    }

    public void setLoanNo(String loanNo) {
        this.loanNo = loanNo;
    }

    public void setSavingsAccountNo(String savingsAcoountNo) {
        this.savingsAccountNo = savingsAcoountNo;
    }


    /*
     * To let another class simply check password without accessing whole details of customer password
     */
    public boolean checkPassword(String pass) {
       if (pass.equals(this.password)) {
           return true;
       } else {
           return false;
       }
    }


    /*
     * show customer pesonal details
     */
    public void showCustomerDetails(){

                System.out.println("Customer ID:"+this.customerID+"\n"+
                           "Customer Name:"+this.name+"\n"+
                           "NIC No.:"+this.NICno+"\n"+
                           "Address:"+this.address+"\n"+
                           "Telephone No:"+this.teleNo+"\n");

    }

}
//end of class